package com.qf.service.impl;

import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.Liu
 * @date 2021/12/14 21:28
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public List<User> findAllUser() {
        List<User> user = userMapper.findAllUser();
        if(user!=null){
            System.out.println("执行了业务方法");
            return user;
        }
        return null;
    }

    /**
     * 查找用户
     * @param tel
     * @param password
     * @return
     */
    @Override
    public User findUser(String tel, String password) {
        User user = userMapper.findUser(tel);
        //System.out.println(user);
        if(user!=null && user.getPassword().equals(password)){
            return user;
        }
        return null;
    }
}
